package views;

import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import controller.SwitchPanel;
import controller.TableListener;
import model.TableModel;

@SuppressWarnings("serial")
public class TablePanel extends JPanel{
	
	public JTable table;
	private JScrollPane scroll;
	public TableModel tablemodel;
	public ListSelectionModel lsm;
	
	
	public TablePanel(SwitchPanel sp, WerknemersInkijkenPanel panel){

		tablemodel = new TableModel();
		table = new JTable(tablemodel);
		table.setModel(tablemodel);
		table.setPreferredScrollableViewportSize(new Dimension(1100,700));
		table.setFillsViewportHeight(true);
		table.setRowSelectionAllowed(true);
		table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		table.addMouseListener(new TableListener(sp, panel));	
		
		scroll = new JScrollPane();
		scroll.setViewportView(table);
		
		add(scroll);

		
	}
	public JTable getTable() {
		return table;
	}
	
	public void setTable(JTable table) {
		this.table = table;
	}
	public ListSelectionModel getLsm() {
		return lsm;
	}
	public void setLsm(ListSelectionModel lsm) {
		this.lsm = lsm;
	}	
}
